﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="../layui/lib/layui-v2.6.3/css/layui.css" rel="stylesheet" />
    <link href="../layui/css/public.css" rel="stylesheet" />
    <style>
        body {
            background-color: white;
        }
    </style>
</head>
<body>
    <ul class="layui-timeline" id="log">
        <li class="layui-timeline-item">
            <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
            <div class="layui-timeline-content layui-text">
                <h3 class="layui-timeline-title">8月16日</h3>
                <p>部门经理</p>
                <ul>
                    <li>同意</li>
                </ul>
            </div>
        </li>
        <li class="layui-timeline-item">
            <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
            <div class="layui-timeline-content layui-text">
                <h3 class="layui-timeline-title">8月15日</h3>
                <p>
                    用户发起
                </p>
            </div>
        </li>
    </ul>
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script src="~/layui/lib/layui-v2.6.3/layui.js"></script>
    <script>
        //接收主页传过来的数据
        var id = GetQueryString("id");

        //封装GetQueryString()方法来获取URL后面的value值
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return decodeURI(r[2]);
            return null;
        }

        //渲染列表
        $.ajax({
            url: "/WorkFlow_InstanceStep/getLogList",
            type: "get",
            data: { instanceId: id },
            success: function (res) {
                console.log(res)
                //给表单赋值
                //获取需要的数据
                var group = res.data;

                //拼接字符串
                var str = '';
                //对数据做遍历，拼接到页面显示
                for (var i = 0; i < group.length; i++) {
                    str += '<li class="layui-timeline-item">' +
                        '<i class="layui-icon layui-timeline-axis"> &#xe63f; </i>' +
                        '<div class="layui-timeline-content layui-text">' +
                        '<h3 class="layui-timeline-title">' + group[i].createTime + '</h3>' +
                        '<p>' + group[i].title + '</p>' +
                        '<ul>' +
                        '<li>' + "状态：" + group[i].status + '</li>' +
                        '<li>' + "理由：" + group[i].description + '</li>' +
                        '</ul>' +
                        '</div>' +
                        ' </li>';
                }


                //放入页面的容器显示
                $('#log').html(str);

            }
        })
    </script>

</body>
</html>